﻿@{
    ViewBag.Title = "最新";
}
@using EmoneyWeiXinEntity;
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>最新</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta name="format-detection" content="telephone=no" />
    <meta name="format-detection" content="email=no" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <link href="@Url.Content("~/Static/css/vipuser.css")" rel="stylesheet" />
    <script src="@Url.Content("~/Static/Js/zepto.js")"></script>
    <script src="@Url.Content("~/Static/Js/mTouch.2.4.js")"></script>

</head>
<body>

    @{
        NewsReportEntity newsEntity = ViewBag.NewsReport;
        if (newsEntity == null) { newsEntity = new NewsReportEntity(); }
        StockPrice stockprice = ViewBag.stockPrice;
        WXUserEntity currentUser = ViewBag.CurrentUser;
        List<Video> VideoList = ViewBag.VideoList;
        if (VideoList == null) { VideoList = new List<Video>(); }
         
    }
    <div class="new">
        <div class="new_top">
            <img src="@Url.Content("~/Static/Image/new_img.png")"><span>@currentUser.nickname</span>
        </div>
        <!--最新资讯-->
        <div class="new_information">
            <h3>
                <img src="@Url.Content("~/Static/Image/new_main_img01.png")"><span>最新资讯</span><b>@(newsEntity.createtime)</b></h3>
            <dl>
                <dt>
                    <img src="@newsEntity.ImageUrl"></dt>
                <dd>
                    <h4 style="color: black">@(newsEntity.title.Length > 12 ? newsEntity.title.Substring(0, 12) + "..." : newsEntity.title)</h4>
                    <p>@newsEntity.Summary<a href="@Url.Action("NewsReport", "WXOpen")?weixinid=@(newsEntity.weixinid)&id=@(newsEntity.ID)&fn=@(currentUser.openid)" class="new_information_font">点击查看</a></p>
                </dd>
            </dl>
        </div>
        <!--最新资讯 end-->
        <!--盘后推荐股-->
        <div class="new_information">
            <h3>
                <img src="@Url.Content("~/Static/Image/new_main_img02.png")"><span>每日一股</span><b>@(System.DateTime.Now.ToString("yyyy-MM-dd"))</b></h3>
            <div class="recommend">
                @if (stockprice != null)
                {
                    <table width="100%" cellpadding="0" cellspacing="0" border="0">
                        <tr>
                            <th>股票名称</th>
                            <th>股票代码</th>
                            <th>现价</th>
                            <th>5日涨幅</th>
                        </tr>
                        <tr>
                            <td>@stockprice.N</td>
                            <td>@stockprice.C</td>
                            <td>@stockprice.P</td>
                            <td>@stockprice.F5%</td>
                        </tr>
                    </table>
                }
            </div>
            <span style="color: gray; display: block; text-align: center; font-size: 12px">入市有风险，以上个股不保证收益，仅供参考</span>
        </div>
        <!--盘后推荐股 end-->
        <!--最新视频-->
        <div class="new_information">
            <h3>
                <img src="@Url.Content("~/Static/Image/new_main_img03.png")"><span>培训视频</span><b>@(System.DateTime.Now.ToString("yyyy-MM-dd"))</b></h3>
            <ul class="video">

                @foreach (var item in VideoList)
                {
                    <li>
                        <img src="@Url.Content("~/Static/Image/new_main_img04.png")"><span>@(item.mtg_name.Length > 6 ? item.mtg_name.Substring(0, 6) + "..." : item.mtg_name)</span><b>时间:@item.startDate.ToString("HH:mm")-@item.endDate.ToString("HH:mm")</b>
                        @if (item.class_date > System.DateTime.Now)
                        {
                            <a href="javascript:void(0)" class="btnyuyue" url="@item.Gensee_URL" className="@item.mtg_name" startTime="@item.class_date" endTime="@item.end_date" classId="@item.Id" password="@item.mtg_password" >点击预约</a>
                        }
                        else
                        {
@* <a href="javascript:void(0)" class="btnyuyue" url="@item.Gensee_URL" className="@item.mtg_name" startTime="@item.class_date" endTime="@item.end_date" classId="@item.Id" password="@item.mtg_password">点击预约</a>*@
                            <a href="javascript:void(0)" class="video_font btnEnterHc" url="@item.Gensee_URL" classId="@item.Id" className="@item.mtg_name"  password="@item.mtg_password">点击进入会场</a>
                        }
                    </li>
                }

                @* <li>
                    <img src="@Url.Content("~/Static/Image/new_main_img04.png")"><span>行业研究晨会</span><b>时间:9:40-10:30</b><a href="#">点击预约</a></li>
                <li>
                    <img src="@Url.Content("~/Static/Image/new_main_img04.png")"><span>行业研究晨会</span><b>时间:9:40-10:30</b><a href="#" class="video_font">点击进入会场</a></li>*@
            </ul>
        </div>
        <!--最新视频 end-->
    </div>
</body>
</html>
<script type="text/javascript">
    $(".new_information_font").click(function () {
        $(this).css({ "background": "#959595" });
    });

    $(function () {
        initEvent();
    });




    function initEvent() {
        $(".btnEnterHc").click(function () {
            var $this = $(this);
            var className = $this.attr("className");
            var passWord = $this.attr("password");
            var url = $this.attr("url");
            var openid = '@currentUser.openid';
            url += "?token=" + passWord + "&nickName=@currentUser.openid";
            var classId = $this.attr("classId");
            window.location = '@Url.Action("WatchViedeoRedirect", "vipUser")?goUrl=' + encodeURIComponent(url) + '&className=' + className + '&classId=' + classId + '&openId=' + openid;
        });

        $(".btnyuyue").click(function () { //当点击预约
            var $this = $(this);
            var className = $this.attr("className");
            var startTime = $this.attr("startTime");
            var passWord = $this.attr("password");
            var endTime = $this.attr("endTime");
            var url = $this.attr("url");
            var opendid = '@currentUser.openid';
            var classId = $this.attr("classId");
            $.ajax({
                url: '@Url.Action("YueYue", "VipUser")',
                type: 'post',
                dataType: 'json',
                data: {
                    className: className,
                    startTime: startTime,
                    endTime: endTime,
                    url: url,
                    openid: opendid,
                    classId: classId,
                    password: passWord
                },
                success: function (data) {
                    if (data == "0") {
                        alert("预约成功");
                    } else
                        if (data == "3") {
                            alert("该视频，你已经进行过预约");
                        }
                        else {
                            alert("预约失败");
                        }
                }
            });

        });
    }
</script>
